﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


using DotNetNuke;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using Microsoft.ApplicationBlocks.Data;
using System.Text;
using CWCare.Modules.cwcProvider.Components;

namespace CWCare.Modules.cwcProvider
{
    public partial class Main : PortalModuleBase, IActionable
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string go = this.Request.Params.Get("go");
            if (string.IsNullOrEmpty(go))
            {
                DotNetNuke.Entities.Modules.PortalModuleBase objmodule = null;
                objmodule = (PortalModuleBase)LoadControl("ViewProvider.ascx");
                objmodule.ModuleConfiguration = this.ModuleConfiguration;
                this.Controls.Add(objmodule);
            }
            else
            {
                DotNetNuke.Entities.Modules.PortalModuleBase objmodule = null;
                objmodule = (PortalModuleBase)LoadControl(go + ".ascx");
                objmodule.ModuleConfiguration = this.ModuleConfiguration;
                this.Controls.Add(objmodule);
            }
        }
        /// ----------------------------------------------------------------------------- 
        /// <summary> 
        /// Registers the module actions required for interfacing with the portal framework 
        /// </summary> 
        /// <value></value> 
        /// <returns></returns> 
        /// <remarks></remarks> 
        /// <history> 
        /// </history> 
        /// ----------------------------------------------------------------------------- 
        public ModuleActionCollection ModuleActions
        {
            get
            {
                string paraId = string.Empty;
                if (!string.IsNullOrEmpty(Request.Params.Get("pid")))
                {
                    paraId = "&pid=" + Request.Params.Get("pid");
                }

                ModuleActionCollection Actions = new ModuleActionCollection();
                Actions.Add(GetNextActionID(), "Edit Provider",
                   ModuleActionType.AddContent, "", "add.gif", "Default.aspx?TabId=" + this.TabId + paraId + "&go=UpdateProvider",
                   false, DotNetNuke.Security.SecurityAccessLevel.Edit, true, false);
                Actions.Add(GetNextActionID(), "Edit Location",
                   ModuleActionType.AddContent, "", "add.gif", "Default.aspx?TabId=" + this.TabId + paraId + "&go=UpdateLocation",
                   false, DotNetNuke.Security.SecurityAccessLevel.Edit, true, false);
                Actions.Add(GetNextActionID(), "Mapping Provider",
                   ModuleActionType.AddContent, "", "add.gif", "Default.aspx?TabId=" + this.TabId + paraId + "&go=MappingProvider",
                   false, DotNetNuke.Security.SecurityAccessLevel.Edit, true, false);
                return Actions;
            }
        }
    }


}